function [s]= LinearConstrain(a, b)
if a >b
    a = b;
elseif a < 0
    a = 0;
end
s = a;
end